<?php 
	session_start();
	require_once("../includes/public.inc.php");
	$type = isset($_GET['type'])?$_GET['type']:'';
	$username = isset($_SESSION['username'])?$_SESSION['username']:'';
	if (empty($username))
	{
		echo "<script>alert('亲你还没有登录哦');history.back();</script>";	exit;
	}
	if ($type=='dg')
	{
		$user = mysql_fetch_array(mysql_query("select * from ".DBQIAN."daogou where username='".$username."' order by id desc limit 1"));
	}
	else 
	{
		$user = mysql_fetch_array(mysql_query("select * from ".DBQIAN."users where username='".$username."' order by id desc limit 1"));
	}
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>个人信息</title>
<link rel="stylesheet" type="text/css" href="css/geren.css" media="all">
</head>
<body>
<div class="pz-css">
	<ul class="top-tool">
		<li class="title">个人信息</li>
		<li class="back"><a href="javascript:history.go(-1)"></a>
		</li><li class="home"><a href="index.php?type=<?=$_GET['type']?>"></a></li>
	</ul>
	<form action="gerensave.php?type=<?=$type?>" id="submit_form" method="post">
		<div class="pz-panel" style="background-color: rgb(255, 255, 255);">
			<table class="list" border="0" cellspacing="0" width="100%">
			<tbody><tr>
				<td style="color: red;" width="90">手机号码：</td>
				<td align="left"><span class="span12"><?=$user['username']?></span></td>
			</tr>
			<tr>
				<td>真实姓名：</td>
				<td align="left"><span class="span12"><input value="<?=$user['name']?>" maxlength="20" id="userName" name="name" type="text"></span></td>
			</tr>
			<tr>
				<td>性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别：</td>
				<td align="left"> 
	             <input type="radio" name="sex" id="status" value="1" <?if (trim($user['sex'])==1):?> checked="checked"<?endif;?> />男
	          	 <input type="radio" name="sex" id="status" value="0" <?if (trim($user['sex'])==0):?> checked="checked"<?endif;?> /> 女
            </td>
			</tr>
			<?if ($type=='dg'):?>
            <tr>
				<td>门店名称：</td>
				<td align="left"><span class="span12"><input placeholder="" value="<?=$user['shopname']?>" id="shopname" name="shopname" type="text"></span></td>
			</tr>
            <tr>
				<td>门店地址：</td>
				<td align="left"><span class="span12"><input placeholder="" value="<?=$user['shopaddress']?>" id="shopaddress" name="shopaddress" type="text"></span></td>
			</tr>
            <tr>
				<td>职位：</td>
				<td align="left" id="job">
					<span class="span12">
						<select name="job">
							<option value="">请选择..</option>
							<option value="1" <?if ($user['job']==1):?>selected="selected"<?endif;?>>老板</option>
							<option value="2" <?if ($user['job']==2):?>selected="selected"<?endif;?>>店长</option>
							<option value="3" <?if ($user['job']==3):?>selected="selected"<?endif;?>>导购</option>
							<option value="4" <?if ($user['job']==4):?>selected="selected"<?endif;?>>其他</option>
						</select>
					</span>
				</td>
			</tr>
			<?else:?>
				<tr>
					<td>详细地址：</td>
					<td align="left"><span class="span12"><input placeholder="用于邮寄礼品" value="<?=$user['address']?>" id="address" name="address" type="text"></span></td>
				</tr>
			<?endif; ?>
            <input id="id" name="id" value="<?=$user['id']?>" type="hidden">
			</tbody></table>
		</div>
		<div class="group">
			<div class="span6"><button type="button" onclick="location.href='person.php?type=<?=$type?>'">会员中心</button></div><div class="span6"><button class="red">确认修改</button></div>
		</div>
	</form>
</div>
</body>
</html>